package c.e.b.h.e.s.j;

import android.util.Log;
import c.e.b.h.e.b;
import c.e.b.h.e.k.g;
import c.e.b.h.e.n.c;
import c.e.b.h.e.n.d;
import java.io.IOException;

/* compiled from: AbstractAppSpiCall */
public abstract class a extends c.e.b.h.e.k.a {
    public final String f;

    public a(String str, String str2, c cVar, c.e.b.h.e.n.a aVar, String str3) {
        super(str, str2, cVar, aVar);
        this.f = str3;
    }

    public boolean d(c.e.b.h.e.s.i.a aVar, boolean z) {
        b bVar = b.a;
        if (z) {
            c.e.b.h.e.n.b b = b();
            b.d.put("X-CRASHLYTICS-ORG-ID", aVar.a);
            b.d.put("X-CRASHLYTICS-GOOGLE-APP-ID", aVar.b);
            b.d.put("X-CRASHLYTICS-API-CLIENT-TYPE", "android");
            b.d.put("X-CRASHLYTICS-API-CLIENT-VERSION", this.f);
            b.c("org_id", aVar.a);
            b.c("app[identifier]", aVar.c);
            b.c("app[name]", aVar.g);
            b.c("app[display_version]", aVar.d);
            b.c("app[build_version]", aVar.e);
            b.c("app[source]", Integer.toString(aVar.h));
            b.c("app[minimum_sdk_version]", aVar.i);
            b.c("app[built_sdk_version]", "0");
            if (!g.r(aVar.f)) {
                b.c("app[instance_identifier]", aVar.f);
            }
            StringBuilder g = c.b.a.a.a.g("Sending app info to ");
            g.append(this.a);
            bVar.b(g.toString());
            try {
                d a = b.a();
                int i = a.a;
                String str = "POST".equalsIgnoreCase(b.a.name()) ? "Create" : "Update";
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append(str);
                stringBuilder.append(" app request ID: ");
                stringBuilder.append(a.c.c("X-REQUEST-ID"));
                bVar.b(stringBuilder.toString());
                g = new StringBuilder();
                g.append("Result was ");
                g.append(i);
                bVar.b(g.toString());
                return c.e.a.c.a.p(i) == 0;
            } catch (IOException e) {
                if (bVar.a(6)) {
                    Log.e("FirebaseCrashlytics", "HTTP request failed.", e);
                }
                throw new RuntimeException(e);
            }
        }
        throw new RuntimeException("An invalid data collection token was used.");
    }
}
